O-O Introduction Exercise

These exercises are designed to evaluate your knowledge and comprehension of Object-Oriented Programming concepts. It is expected that you should be able to correctly answer all or nearly all of the questions and problems presented. You should do these exercises by yourself. This exercise represents the most foundational and elementary information to be mastered by anyone involved with Object-Oriented Programming.

  1. In your own words explain the concept associated with the following terms.

a. Abstraction

 

b. Encapsulation

 

c. Polymorphism

 

d. Inheritance

 

 

 

2. What type of composition relationship is characterized by a peer-to-peer relationship? Give an example.

 

 

3. What type of composition relationship is characterized by the perspective of the parts and relationships are formed to obtain services from other objects? Give an example.

 

 

4. What type of composition relationship is characterized by whole-part relationship? Give an example.

 

 

5. If two objects contain the identical state information, and are instances of the same class, are they considered identical? (Yes or No) Why?

 

6. What type relationship is characterized by an "Is-A" relationship?

 

7. What type relationship is characterized by an "Has-A" relationship?

 

8. For each of the following pairs of items decide what type of relationship properly models the pair. That is, inheritance (I), aggregation (A) or association (S).

  1. (Car) – (Steering Wheel) _______
  2. (Car) – (Seat) _______
  3. (Car) – (Driver) _______
  4. (Car) – (Sedan) _______
  5. (Truck) – (Steering Wheel) _______
  6. (Vehicle) – (Truck) _______
  7. (Vehicle) – (Car) _______